// 游戏核心类型定义

export interface GameState {
  id: string
  name: string
  difficulty: DifficultyLevel
  currentView: GameView
  gameTime: number
  realTime: number
  isPaused: boolean
  speed: number
  version: string
  createdAt: number
  lastSaved: number
  achievements: string[]
  statistics: {
    totalPlayTime: number
    resourcesGathered: Record<string, number>
    buildingsBuilt: number
    technologiesResearched: number
    shipsBuilt: number
    battlesWon: number
    planetsColonized: number
  }
}

export type DifficultyLevel = 'novice' | 'easy' | 'normal' | 'hard' | 'expert' | 'legendary'

export type GameView = 'overview' | 'resources' | 'buildings' | 'technology' | 'ships' | 'diplomacy' | 'galaxy' | 'settings'

export interface SaveSlot {
  id: string
  name: string
  gameState?: GameState
  timestamp: number
  version: string
  screenshot?: string
}

export interface GameConfig {
  autoSave: boolean
  autoSaveInterval: number
  soundEnabled: boolean
  musicEnabled: boolean
  soundVolume: number
  musicVolume: number
  showTutorial: boolean
  language: string
  theme: string
  notifications: boolean
  pauseOnFocusLoss: boolean
}

export interface UnlockCondition {
  type: 'resource' | 'building' | 'technology' | 'time' | 'event'
  target: string
  value: number
  operator: 'gte' | 'lte' | 'eq'
}

export interface Effect {
  type: 'resource_production' | 'resource_capacity' | 'building_efficiency' | 'research_speed' | 'ship_attribute'
  target: string
  value: number
  modifier: 'add' | 'multiply' | 'set'
}

export interface Cost {
  resourceId: string
  amount: number
}

export interface GameEvent {
  id: string
  type: EventType
  title: string
  description: string
  trigger: EventTrigger
  conditions: UnlockCondition[]
  effects: Effect[]
  choices?: EventChoice[]
  weight: number
}

export type EventType = 'resource' | 'technology' | 'diplomacy' | 'military' | 'exploration' | 'disaster' | 'opportunity'

export interface EventTrigger {
  type: 'time' | 'resource' | 'building' | 'technology' | 'random'
  conditions: Record<string, any>
}

export interface EventChoice {
  id: string
  text: string
  effects: Effect[]
  costs?: Cost[]
}

export interface Achievement {
  id: string
  name: string
  description: string
  category: AchievementCategory
  difficulty: AchievementDifficulty
  conditions: UnlockCondition[]
  rewards: Effect[]
  isHidden: boolean
  isUnlocked: boolean
  progress: number
  maxProgress: number
}

export type AchievementCategory = 'progress' | 'collection' | 'challenge' | 'exploration' | 'combat' | 'diplomacy' | 'technology'

export type AchievementDifficulty = 'bronze' | 'silver' | 'gold' | 'platinum' | 'diamond'